﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NUnit.Framework;
using Selenium;

namespace time
{
    [TestFixture]
    class spider1
    {
        private ISelenium selenium;
        [SetUp]
        public void SetupTest()
        {
            Console.Write("start");
            //error = new StringBuiler();
        }

        [TearDown]
        public void TeardownTest()
        {
            try
            {
                Console.Write("stop");
                selenium.Stop();
            }
            catch (Exception)
            {

            }

        }



        [Test]
        public void t1()
        {
        //http://nospider.com/About.aspx
        //http://nospider.com/Default.aspx
        //http://nospider.com/login.aspx
        //http://nospider.com/Register.aspx

            string[] s = { @"http://nospider.com/About.aspx", @"http://nospider.com/Default.aspx", @"http://nospider.com/login.aspx", @"http://nospider.com/Register.aspx" };
           
            Random r = new Random();
            int i = 0;
            while(i<10){
                int j = r.Next(0, 3);
                selenium = new DefaultSelenium("localhost", 4444, "*chrome", s[j]);
                selenium.Start();
                selenium.Open(s[j]);

                selenium.WindowMaximize();
                System.Threading.Thread.Sleep(2000);

                selenium.Stop();

                i++;
            }

            
        }

    }
}
